package com.lianup.noname.common;

import java.util.Optional;
import java.util.stream.Stream;

/**
 * http请求头枚举
 */
public enum HttpHeaderEnum {

    /*cookie*/
    COOKIE("cookie"),
    /*content-length*/
    CONTENT_LENGTH("content-length"),
    /*content-type*/
    CONTENT_TYPE("content-type");

    private String desc;

    HttpHeaderEnum(String desc) {
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    public static Optional<HttpHeaderEnum> parse(String value){
        return Stream.of(values()).filter(header->header.getDesc().equals(value)).findAny();
    }
}